<extend name="Public/base"/>

<block name="body">

    <div class="main-title">
        <h2>投诉列表</h2>
    </div>

    <div class="cf">
        <div class="fl">
            <!-- <a class="btn" href="{:U('kbxx')}">商户信息</a>
            <a class="btn" href="{:U('index?type=renewal')}">续期用户</a>
            <a class="btn" href="{:U('index?export=true')}">导出数据</a>
            <button class="btn kouk" >一键扣款</button>
            <button class="btn yanqi" >一键延期</button> -->

        </div>
        <php>
            $LOAN_STATUS = C('LOAN_STATUS');
        </php>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <input name="title" class="search-input" value="" placeholder="请输入名字、UID" type="text">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>

            </div>


        </div>
    </div>

    <div class="data-table table-striped" >
        <table style="font-size:14px;">
            <thead>
                <tr>
                    <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                    <th>ID</th>
                    <th>投诉人</th>
                    <th>被投诉店铺</th>
                    <th>订单号</th>
                    <th>涉及金额</th>
                    <th>联系方式</th>
                    <th>支付宝</th>
                    <th>时间</th>
                    <th>投诉状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <notempty name="_list">
                <volist name="_list" id="rows">
                    <tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="{$rows['id']}" /></td>
                        
                        <td>{$rows['id']}</td>
                        <td>{$rows['complain']}</td>
                        <td>{$rows['complainant']}</td>
                        <td>{$rows['trade_no']}</td>
                        <td>{$rows['money']}</td>
                        <td>{$rows['phone']}</td>
                        <td>{$rows['account']}</td>
                        <td>
                            <php>
                                if(empty($rows['time'])){
                                echo '';
                            }else{
                                echo date("Y-m-d",$rows['time']);
                            }
                            </php>
                        </td>
                            
                        <td>
                            <php>
                                if($rows['status']==0){
                                    echo '<font style="color:red">待处理</font>';
                                }else if($rows['status']==1){
                                    echo '<font style="color:green">已处理</font>';
                                }else if($rows['status']==2){
                                    echo '<font style="color:orange">处理中</font>';
                                }else {
                                    echo '<font style="color:red">不受理</font>';
                                }
                            </php>
                        </td>

                        
                        <td>

                            &nbsp;&nbsp;
                            <a title="详细" href="{:U('ts_view?id='.$rows['id'])}">详细</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="14" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>



    </div>

    <div class="page"  style="float:left;margin-right:300px;">{$_page}</div>
</block>

<block name="script">
    <link href="/Public/static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <link href="/Public/static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/Public/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="/Public/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
    $(function(){
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var status = $("#sch-sort-txt").attr("data");
            var type   = $("#sch-sort-txt_type").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(status != ''){
                query += '&status=' + status + "&" + query;
            }
            if(type != ''){
                query += '&type=' + type + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });





        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down1").hover(function(){
            $("#sub-sch-menu").removeClass("hidden");
        },function(){
            $("#sub-sch-menu").addClass("hidden");
        });
        $("#sub-sch-menu li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu").addClass("hidden");
            })
        });

        $(".search-form").find(".drop-down_type").hover(function(){
            $("#sub-sch-menu_type").removeClass("hidden");
        },function(){
            $("#sub-sch-menu_type").addClass("hidden");
        });

        $("#sub-sch-menu_type li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt_type").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu_type").addClass("hidden");
            })
        });
        $('#time-start').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });

        $('#time-end').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });




        $('.kouk').click(function(){
            obj = document.getElementsByClassName("ids");
            // console.log(obj)
            check_val = [];
            for(k in obj){
                if(obj[k].checked)
                    check_val.push(obj[k].value);
            }
            $.ajax({
                type:'post',
                data:{'ids':check_val},
                // dataType:'json',
                url:"index.php?m=admin&c=capital&a=kouk",
                success:function(m){
                    alert(m)
                        // alert("提交扣款人数："+ids+"，成功："+success+"，失败："+default+"。失败合同号："+ht+"对应失败原因："+error)
                }
            })
        })




        $('.yanqi').click(function(){
            alert(0)
        })












    })


</script>
</block>